<form class="layui-form">
    {% if group_rules %}

        {% for key,rules in group_rules %}
            <div>
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>{{ __('permission')[key] }}</legend>
                </fieldset>
                <div class="plr30 ptb10 mtb10">
                    <div class="layui-row">
                        {% for item in  rules %}
                            <div class="layui-col-md2">
                                <div class="layui-form-item">
                                    <input type="checkbox"
                                           name="rules[]"
                                           value="{{ item.id }}"
                                           title="{{ item.title }}"
                                           data-id="{{ item.id }}"
                                           lay-filter="rules"
                                            {% if has_rules is iterable  and (item.id in has_rules) %}
                                                checked
                                            {% endif %}
                                    >
                                    <div class="layui-word-aux">
                                        {{ item.url }}
                                    </div>
                                </div>
                            </div>
                        {% endfor %}
                    </div>

                </div>
            </div>
        {% endfor %}
    {% endif %}
</form>